// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

const RouteView = {
    name: 'RouteView',
    render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: '/overview/overview',
    children: [
      {

          path: '/overview/overview',
          name: 'overview',
          component: () => import('@/views/overview/Overview'),
          meta: { title: '概览', keepAlive: false, }

      },
      {
        path: '/assets',
        name: 'assets',
        component: RouteView,
        meta: { title: '资产管理', keepAlive: true , permission: ['资产信息','资产分组设置','资产发现设置']},
        children: [
          {
            path: '/assets/info',
            name: 'assetsinfo',
            component: () => import('@/views/assetManage/AssetInfo'),
            meta: { title: '资产信息', keepAlive: false, permission: ['资产信息'] }
          },
          {
            path: '/assets/group',
            name: 'assetsgroup',
            component: () => import('@/views/assetManage/AssetGrouping'),
            meta: { title: '资产分组设置', keepAlive: false, permission: ['资产分组设置'] }
          },
          {
            path: '/assets/discovery',
            name: 'assetsdiscovery',
            component: () => import('@/views/assetManage/AssetDiscovery'),
            meta: { title: '资产发现设置', keepAlive: false, permission: ['资产发现设置'] }
          }
        ]
      },
      {
        path: '/patch',
        name: 'patch',
        component: RouteView,
        meta: { title: '补丁管理', keepAlive: true, permission: ['补丁库','补丁组管理','黑名单补丁','补丁更新管理','文件库','补丁信息']  },
        children: [
          {
            path: '/patch/library',
            name: 'patchlibrary',
            component: () => import('@/views/patchManage/library'),
            meta: { title: '补丁库', keepAlive: false, permission: ['补丁库'] }
          },
          {
            path: '/patch/group',
            name: 'patchgroup',
            component: () => import('@/views/patchManage/GroupingManage'),
            meta: { title: '补丁组管理', keepAlive: false, permission: ['补丁组管理'] }
          },
          {
            path: '/patch/black',
            name: 'patchblack',
            component: () => import('@/views/patchManage/BlacklistPatch'),
            meta: { title: '黑名单补丁', keepAlive: false, permission: ['黑名单补丁'] }
          },
          {
            path: '/patch/update',
            name: 'patchupdate',
            component: () => import('@/views/patchManage/PatchUpdateManage'),
            meta: { title: '补丁更新管理', keepAlive: false, permission: ['补丁更新管理'] }
          },
          {
            path: '/patch/file',
            name: 'patchfile',
            component: () => import('@/views/patchManage/file'),
            meta: { title: '文件库', keepAlive: false, permission: ['文件库'] }
          },
          {
            path: '/patch/info',
            name: 'patchinfo',
            component: () => import('@/views/patchManage/PatchInfo'),
            meta: { title: '补丁信息', keepAlive: false, permission: ['补丁信息'] }
          }
        ]
      },
      {
        path: '/policy',
        name: 'policy',
        component: RouteView,
        meta: { title: '策略管理', keepAlive: true, permission: ['测试补丁分发','正式补丁分发','人工补丁分发','普通文件分发'] },
        children: [
          {
            path: '/policy/test',
            name: 'policytest',
            component: () => import('@/views/policy/test'),
            meta: { title: '测试补丁分发', keepAlive: false, permission: ['测试补丁分发'] }
          },
          {
            path: '/policy/formal',
            name: 'policyformal',
            component: () => import('@/views/policy/formal'),
            meta: { title: '正式补丁分发', keepAlive: false, permission: ['正式补丁分发'] }
          },
          {
            path: '/policy/manmade',
            name: 'policymanmade',
            component: () => import('@/views/policy/manmade'),
            meta: { title: '人工补丁分发', keepAlive: false, permission: ['人工补丁分发'] }
          },
          {
            path: '/policy/normal',
            name: 'policynormal',
            component: () => import('@/views/policy/normal'),
            meta: { title: '普通文件分发', keepAlive: false, permission: ['普通文件分发'] }
          },
        ]
      },

      {
        path: '/log',
        name: 'log',
        component: RouteView,
        meta: { title: '数据查询', keepAlive: true, permission: ['策略执行日志','漏洞扫描日志'] },
        children: [
          {
            path: '/log/policy',
            name: 'logpolicy',
            component: () => import('@/views/log/policy'),
            meta: { title: '策略执行日志', keepAlive: false, permission: ['策略执行日志'] }
          },
          {
            path: '/log/loophole',
            name: 'logloophole',
            component: () => import('@/views/log/loophole'),
            meta: { title: '漏洞扫描日志', keepAlive: false, permission: ['漏洞扫描日志'] }
          },
          {
            path: '/log/operation',
            name: 'logoperation',
            component: () => import('@/views/log/operation'),
            meta: { title: '操作日志', keepAlive: false, permission: ['操作日志'] }
          }
        ]
      },
      {
        path: '/systerm',
        name: 'systerm',
        component: RouteView,
        meta: { title: '系统配置', keepAlive: true, permission: ['通用配置','网络配置','用户配置','系统安全','备份管理','级联配置','告警配置','授权管理']  },
        children: [
          {
            path: '/systerm/commonconfig',
            name: 'commonconfig',
            component: () => import('@/views/systerm/commonconfig'),
            meta: { title: '通用配置', keepAlive: false, permission: ['通用配置'] }
          },
          {
            path: '/systerm/netconfig',
            name: 'netconfig',
            component: () => import('@/views/systerm/netconfig'),
            meta: { title: '网络配置', keepAlive: false, permission: ['网络配置'] }
          },
          {
            path: '/systerm/userconfig',
            name: 'userconfig',
            component: () => import('@/views/systerm/userconfig'),
            meta: { title: '用户配置', keepAlive: false, permission: ['用户配置'] }
          },
          {
            path: '/systerm/safetyconfig',
            name: 'safetyconfig',
            component: () => import('@/views/systerm/safetyconfig'),
            meta: { title: '系统安全', keepAlive: false, permission: ['系统安全'] }
          },
          {
            path: '/systerm/backup',
            name: 'backup',
            component: () => import('@/views/systerm/backup'),
            meta: { title: '备份管理', keepAlive: false, permission: ['备份管理'] }
          },
          {
            path: '/systerm/cascade',
            name: 'cascade',
            component: () => import('@/views/systerm/cascade'),
            meta: { title: '级联配置', keepAlive: false, permission: ['级联配置'] }
          },
          {
            path: '/systerm/warn',
            name: 'warn',
            component: () => import('@/views/systerm/warn'),
            meta: { title: '告警配置', keepAlive: false, permission: ['告警配置'] }
          },
          {
            path: '/systerm/authorize',
            name: 'authorize',
            component: () => import('@/views/systerm/authorize'),
            meta: { title: '授权管理', keepAlive: false, permission: ['授权管理'] }
          }
        ]
      },
    ]
  }
  ,
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
    {
        path: '/user',
        component: UserLayout,
        redirect: '/user/login',
        hidden: true,
        children: [
            {
                path: 'login',
                name: 'login',
                component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
            },
            {
                path: 'register',
                name: 'register',
                component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
            },
            {
                path: 'register-result',
                name: 'registerResult',
                component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
            },
            {
                path: 'recover',
                name: 'recover',
                component: undefined
            }
        ]
    },
    {
        path: '/404',
        component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
    }
]
